﻿<s:SurfaceWindow x:Class="WinwiseARDrone.SurfaceV1Client.SurfaceWindowMain"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:s="http://schemas.microsoft.com/surface/2008"
                 xmlns:controls="clr-namespace:WinwiseARDrone.SurfaceV1Client.Controls"
                 xmlns:vm="clr-namespace:WinwiseARDrone.SurfaceV1Client.ViewModels"
                 Title="Winwise - AR Drone for Surface">

    <s:SurfaceWindow.Resources>
        <ImageBrush x:Key="FondImageBrush" ImageSource="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/Fond.png"/>

        <!-- Storyboards -->

        <Storyboard x:Key="StartToTableauStoryboard">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="startButton">
                <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="startButton">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="{x:Static Visibility.Collapsed}"/>
            </ObjectAnimationUsingKeyFrames>

            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="stopButton">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="{x:Static Visibility.Visible}"/>
            </ObjectAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="stopButton">
                <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="1"/>
            </DoubleAnimationUsingKeyFrames>

            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="videoFlux">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.8" Value="{x:Static Visibility.Visible}"/>
            </ObjectAnimationUsingKeyFrames>

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="logos">
                <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="logos">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="{x:Static Visibility.Collapsed}"/>
            </ObjectAnimationUsingKeyFrames>

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="ecranTableau">
                <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="selectorHand">
                <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="220"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="ecranIndicateurs">
                <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="TableauToStartStoryboard">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="startButton">
                <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="startButton">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="{x:Static Visibility.Visible}"/>
            </ObjectAnimationUsingKeyFrames>

            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="stopButton">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.4" Value="{x:Static Visibility.Collapsed}"/>
            </ObjectAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="stopButton">
                <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
            </DoubleAnimationUsingKeyFrames>

            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="videoFlux">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
            </ObjectAnimationUsingKeyFrames>

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="logos">
                <SplineDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="logos">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
            </ObjectAnimationUsingKeyFrames>

            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="ecranTableau">
                <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="220"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="selectorHand">
                <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" Storyboard.TargetName="ecranIndicateurs">
                <SplineDoubleKeyFrame KeyTime="0:0:0.8" Value="-120"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="GaucherStoryboard">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="imgFondTableau">
                <SplineDoubleKeyFrame KeyTime="0" Value="-1"/>
            </DoubleAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="stopButton">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,-50,130"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="stickMove">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Left}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="stickMove">
                <SplineThicknessKeyFrame KeyTime="0" Value="315,0,0,20"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="switchButton">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Left}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="switchButton">
                <SplineThicknessKeyFrame KeyTime="0" Value="210,0,0,38"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="stickAltitude">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Right}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="stickAltitude">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,220,20"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="stickRotation">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Right}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="stickRotation">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,320,20"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="txtAltitude">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Right}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="txtAltitude">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,218,115"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="txtRotation">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Right}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="txtRotation">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,312,90"/>
            </ThicknessAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="logoWinwise">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,-50,25"/>
            </ThicknessAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="DroitierStoryboard">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="imgFondTableau">
                <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="stopButton">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,50,130"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="stickMove">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Right}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="stickMove">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,315,20"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="switchButton">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Right}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="switchButton">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,210,38"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="stickAltitude">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Left}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="stickAltitude">
                <SplineThicknessKeyFrame KeyTime="0" Value="220,0,0,20"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="stickRotation">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Left}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="stickRotation">
                <SplineThicknessKeyFrame KeyTime="0" Value="320,0,0,20"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="txtAltitude">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Left}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="txtAltitude">
                <SplineThicknessKeyFrame KeyTime="0" Value="218,0,0,115"/>
            </ThicknessAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.HorizontalAlignment)" Storyboard.TargetName="txtRotation">
                <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static HorizontalAlignment.Left}"/>
            </ObjectAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="txtRotation">
                <SplineThicknessKeyFrame KeyTime="0" Value="312,0,0,90"/>
            </ThicknessAnimationUsingKeyFrames>
            <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="logoWinwise">
                <SplineThicknessKeyFrame KeyTime="0" Value="0,0,50,25"/>
            </ThicknessAnimationUsingKeyFrames>
        </Storyboard>

    </s:SurfaceWindow.Resources>

    <s:SurfaceWindow.Triggers>
        <EventTrigger SourceName="selectorHand" RoutedEvent="controls:HalfMoonSelector.LeftSelected">
            <BeginStoryboard Storyboard="{StaticResource GaucherStoryboard}"/>
        </EventTrigger>
        <EventTrigger SourceName="selectorHand" RoutedEvent="controls:HalfMoonSelector.RightSelected">
            <BeginStoryboard Storyboard="{StaticResource DroitierStoryboard}"/>
        </EventTrigger>
    </s:SurfaceWindow.Triggers>

    <Grid Height="768"
          Width="1024"
          Background="{StaticResource FondImageBrush}">

        <!-- ******** -->
        <!-- PHASE 01 -->
        <!-- ******** -->

        <Grid Visibility="{Binding VisibilityStart}">

            <Image x:Name="logos"
               Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/Logos.png"
               Width="442"
               Height="181"
               VerticalAlignment="Top"
               Margin="0,173,0,0"/>

            <s:SurfaceButton x:Name="startButton"
                         VerticalAlignment="Bottom"
                         HorizontalAlignment="Center"
                         Margin="0,0,0,130"
                         Command="{Binding CommandStart}">
                <s:SurfaceButton.Triggers>
                    <EventTrigger RoutedEvent="Button.Click">
                        <BeginStoryboard Storyboard="{StaticResource StartToTableauStoryboard}"/>
                    </EventTrigger>
                </s:SurfaceButton.Triggers>
                <s:SurfaceButton.Template>
                    <ControlTemplate>
                        <Grid Width="80"
                          Height="80">
                            <Grid.Resources>
                                <Storyboard x:Key="InternalRotationStart" RepeatBehavior="Forever">
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="TourImage">
                                        <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                        <SplineDoubleKeyFrame KeyTime="0:0:5" Value="360"/>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </Grid.Resources>
                            <Grid.Triggers>
                                <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                                    <BeginStoryboard Storyboard="{StaticResource InternalRotationStart}"/>
                                </EventTrigger>
                            </Grid.Triggers>
                            <Image x:Name="TourImage"
                               RenderTransformOrigin="0.5,0.5"
                               Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/StartButtonCircle.png">
                                <Image.RenderTransform>
                                    <RotateTransform Angle="0"/>
                                </Image.RenderTransform>
                            </Image>
                            <Image x:Name="StateImageNormal" 
                               Width="42"
                               Height="42"
                               Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/StartButton.png" />
                            <Image x:Name="StateImagePressed" 
                               Visibility="Collapsed"
                               Width="42"
                               Height="42"
                               Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/StartButtonTouch.png" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="ToggleButton.IsPressed" Value="True">
                                <Setter TargetName="StateImageNormal" Property="Visibility" Value="Collapsed"/>
                                <Setter TargetName="StateImagePressed" Property="Visibility" Value="Visible"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </s:SurfaceButton.Template>
            </s:SurfaceButton>

            <controls:HalfMoonSelector x:Name="selectorHand"
                                       HorizontalAlignment="Center"
                                       VerticalAlignment="Bottom">
                <controls:HalfMoonSelector.RenderTransform>
                    <TranslateTransform Y="0"/>
                </controls:HalfMoonSelector.RenderTransform>
            </controls:HalfMoonSelector>

        </Grid>

        <!-- ******** -->
        <!-- PHASE 02 -->
        <!-- ******** -->

        <Grid Visibility="{Binding VisibilityDrone}">

            <Rectangle x:Name="videoFlux"
                   Fill="{Binding VideoBrush}"
                   Height="768"
                   Width="1024"
                   Visibility="Collapsed"/>

            <s:SurfaceButton x:Name="stopButton"
                         Visibility="Collapsed"
                         Opacity="0"
                         VerticalAlignment="Bottom"
                         HorizontalAlignment="Center"
                         Margin="0,0,50,130"
                         Command="{Binding CommandStop}">
                <s:SurfaceButton.Triggers>
                    <EventTrigger RoutedEvent="Button.Click">
                        <BeginStoryboard Storyboard="{StaticResource TableauToStartStoryboard}"/>
                    </EventTrigger>
                </s:SurfaceButton.Triggers>
                <s:SurfaceButton.Template>
                    <ControlTemplate>
                        <Grid Width="80"
                          Height="80">
                            <Grid.Resources>
                                <Storyboard x:Key="InternalRotationStop" RepeatBehavior="Forever">
                                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)" Storyboard.TargetName="TourImage">
                                        <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                        <SplineDoubleKeyFrame KeyTime="0:0:5" Value="360"/>
                                    </DoubleAnimationUsingKeyFrames>
                                </Storyboard>
                            </Grid.Resources>
                            <Grid.Triggers>
                                <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                                    <BeginStoryboard Storyboard="{StaticResource InternalRotationStop}"/>
                                </EventTrigger>
                            </Grid.Triggers>
                            <Image x:Name="TourImage"
                               RenderTransformOrigin="0.5,0.5"
                               Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/StopButtonCircle.png">
                                <Image.RenderTransform>
                                    <RotateTransform Angle="0"/>
                                </Image.RenderTransform>
                            </Image>
                            <Image x:Name="StateImageNormal" 
                               Width="42"
                               Height="42"
                               Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/StopButton.png" />
                            <Image x:Name="StateImagePressed" 
                               Visibility="Collapsed"
                               Width="42"
                               Height="42"
                               Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/StopButtonTouch.png" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="ToggleButton.IsPressed" Value="True">
                                <Setter TargetName="StateImageNormal" Property="Visibility" Value="Collapsed"/>
                                <Setter TargetName="StateImagePressed" Property="Visibility" Value="Visible"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </s:SurfaceButton.Template>
            </s:SurfaceButton>

            <Grid x:Name="ecranTableau">
                <Grid.RenderTransform>
                    <TranslateTransform Y="220"/>
                </Grid.RenderTransform>

                <Image x:Name="imgFondTableau"
                       Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/TableauDeBord.png"
                       Width="750"
                       VerticalAlignment="Bottom"
                       HorizontalAlignment="Center"
                       IsHitTestVisible="False"
                       RenderTransformOrigin="0.5,0.5">
                    <Image.RenderTransform>
                        <ScaleTransform ScaleX="1"/>
                    </Image.RenderTransform>
                </Image>

                <Image x:Name="logoWinwise"
                       Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/LogoWinwise.png"
                       Width="120"
                       VerticalAlignment="Bottom"
                       HorizontalAlignment="Center"
                       Margin="0,0,50,25"
                       IsHitTestVisible="False"/>

                <TextBlock x:Name="txtAltitude"
                           Text="ALTITUDE"
                           Foreground="Black"
                           VerticalAlignment="Bottom"
                           HorizontalAlignment="Left"
                           Margin="218,0,0,115"
                           FontFamily="Century Gothic"
                           FontSize="11"/>

                <controls:LinearStickAnalogique x:Name="stickAltitude"               
                                                VerticalAlignment="Bottom" 
                                                HorizontalAlignment="Left"
                                                Margin="220,0,0,20"  
                                                Sensibility="{Binding SensibilityAltitude}"
                                                Value="{Binding StickAltitudeValue, Mode=TwoWay}"/>

                <TextBlock x:Name="txtRotation"
                           Text="ROTATION"
                           Foreground="Black"
                           VerticalAlignment="Bottom"
                           HorizontalAlignment="Left"
                           Margin="312,0,0,90"
                           FontFamily="Century Gothic"
                           FontSize="11"/>

                <controls:LinearStickAnalogique x:Name="stickRotation" 
                                                VerticalAlignment="Bottom"
                                                HorizontalAlignment="Left"
                                                Margin="320,0,0,20"
                                                RenderTransformOrigin="0.5,0.5"
                                                Sensibility="{Binding SensibilityRotation}"
                                                Value="{Binding StickRotateValue, Mode=TwoWay}">
                    <controls:LinearStickAnalogique.RenderTransform>
                        <RotateTransform Angle="90"/>
                    </controls:LinearStickAnalogique.RenderTransform>
                </controls:LinearStickAnalogique>

                <controls:StickAnalogique x:Name="stickMove" 
                                          VerticalAlignment="Bottom"
                                          HorizontalAlignment="Right"
                                          Margin="0,0,315,20"
                                          Sensibility="{Binding SensibilityMove}"
                                          ValueX="{Binding StickXValue, Mode=TwoWay}"
                                          ValueY="{Binding StickYValue, Mode=TwoWay}"/>

                <s:SurfaceButton x:Name="switchButton" 
                                 VerticalAlignment="Bottom"
                                 HorizontalAlignment="Right"
                                 Margin="0,0,210,38"
                                 Command="{Binding CommandSwitch}">
                    <s:SurfaceButton.Template>
                        <ControlTemplate>
                            <Grid Width="78"
                              Height="78">
                                <Image x:Name="StateImageNormal" 
                                       Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/SwitchCamera.png" />
                                <Image x:Name="StateImagePressed" 
                                       Visibility="Collapsed"
                                       Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/SwitchCameraTouch.png" />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="ToggleButton.IsPressed" Value="True">
                                    <Setter TargetName="StateImageNormal" Property="Visibility" Value="Collapsed"/>
                                    <Setter TargetName="StateImagePressed" Property="Visibility" Value="Visible"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </s:SurfaceButton.Template>
                </s:SurfaceButton>
            </Grid>

            <Grid x:Name="ecranIndicateurs">
                <Grid.RenderTransform>
                    <TranslateTransform Y="-120"/>
                </Grid.RenderTransform>

                <!-- Batterie -->

                <Grid Margin="-150,3,0,0"
                      Width="102"
                      Height="98"
                      VerticalAlignment="Top"
                      HorizontalAlignment="Center">

                    <Image Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/CadranBatterie.png"
                           Width="102"
                           Height="98"/>

                    <Image Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/BatterieEmpty.png"
                           Width="45"
                           Height="20"/>

                    <Image Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/BatterieFull.png"
                           Width="45"
                           Height="20">
                        <Image.Clip>
                            <RectangleGeometry Rect="{Binding BatteryClip}"/>
                        </Image.Clip>
                    </Image>

                    <StackPanel Margin="0,0,0,12"
                                Orientation="Horizontal"
                                VerticalAlignment="Bottom"
                                HorizontalAlignment="Center">
                        <TextBlock Text="{Binding Batterie}"
                                   FontFamily="Century Gothic"
                                   FontSize="18"
                                   Foreground="Black"                           
                                   FontWeight="Bold"/>
                        <TextBlock Text=" %"
                                   FontFamily="Century Gothic"
                                   FontSize="18"
                                   Foreground="Black"                           
                                   FontWeight="Bold"/>
                    </StackPanel>

                </Grid>

                <!-- Altitude -->

                <Grid Width="102"
                      Height="98"
                      VerticalAlignment="Top"
                      HorizontalAlignment="Center"
                      Margin="150,3,0,0">

                    <Image Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/CadranAltitude.png"
                           Width="102"
                           Height="98"/>

                    <TextBlock Text="{Binding AltitudeString}"
                               FontFamily="Century Gothic"
                               FontSize="14"
                               Foreground="Black"                           
                               FontWeight="Bold"
                               Margin="0,0,0,12"
                               VerticalAlignment="Bottom"
                               HorizontalAlignment="Center"/>
                </Grid>

            </Grid>

        </Grid>

        <!-- ******** -->
        <!-- PHASE 03 -->
        <!-- ******** -->

        <Grid Visibility="{Binding VisibilityEmergency}">
            <Image Source="pack://application:,,,/WinwiseARDrone.SurfaceV1Client;component/Assets/Emergency.png"
                   Width="440"
                   Height="180"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Center"/>

            <TextBlock Text="ALERTE !"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center"
                       FontFamily="Century Gothic"
                       Foreground="#FF5E00"
                       FontWeight="Bold"
                       FontSize="40"
                       Margin="0,-120,0,0"/>

            <TextBlock Text="L'ARDrone est en mode 'EMERGENCY', contactez un administrateur pour le reinitialiser."
                       Width="420"
                       TextAlignment="Center"
                       TextWrapping="Wrap"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Center"
                       FontFamily="Century Gothic"
                       Foreground="#FF5E00"
                       FontWeight="Bold"
                       FontSize="18"/>

            <controls:EmergencyControl CommandReset="{Binding CommandReset}"
                                       VerticalAlignment="Top"
                                       HorizontalAlignment="Left"/>
        </Grid>
    </Grid>

</s:SurfaceWindow>
